c++
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int N=50005;
std::vector<int>g[N],vbcc[N];
int dfn[N],low[N],tot;
int stk[N],top;
int n,m,cnt;
void tarjan(int u,bool root){
dfn[u]=low[u]=++tot;
stk[++top]=u;
if(root&&g[u].size()==0){
return;
}
for(int v:g[u]){
if(!dfn[v]){
tarjan(v,false);
low[u]=std::min(low[u],low[v]);
if(low[v]>=dfn[u]){
++cnt;
do{
vbcc[cnt].push_back(stk[top]);
}while(stk[top--]!=v);
vbcc[cnt].push_back(u);
}
}else{
low[u]=std::min(low[u],dfn[v]);
}
}
}
bool cmp(std::vector<int>&a,std::vector<int>&b){
int mn=std::min(a.size(),b.size());
for(int i=0;i<mn;i++){
if(a[i]==b[i])continue;
return a[i]<b[i];
}
return a.size()<b.size();
}
void fc() {
std::cin>>n>>m;
for(int i=0;i<m;i++){
int u,v;std::cin>>u>>v;
if(u!=v){
g[u].push_back(v);
g[v].push_back(u);
}
}
for(int i=1;i<=n;i++){
if(!dfn[i])tarjan(i,false);
}
for(int i=1;i<=cnt;i++){
std::sort(vbcc[i].begin(),vbcc[i].end());
}
std::sort(vbcc+1,vbcc+cnt+1,cmp);
std::cout<<cnt<<"\n";
for(int i=1;i<=cnt;i++){
for(int v:vbcc[i])std::cout<<v<<" ";std::cout<<"\n";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
//std::cin>>t;
while (t--) fc();
return 0;
}